<template>
  <q-page class="q-pa-md">
    <div class="row items-center">
      <div class="q-pb-md text-h5">
        {{ pageTitle }}
      </div>
      <q-space></q-space>
      <search-bar-toggle-btn v-model="$d.searchBarVisibility"></search-bar-toggle-btn>
    </div>
    <!-- 查询菜单 -->
    <div class="q-pa-sm shadow-2 q-mb-md items-center" v-show="$d.searchBarVisibility">
      <div class="row q-col-gutter-sm">
        <div class="q-mr-sm">
          <q-btn color="primary" label="立即发送" @click="doSend" />
        </div>
      </div>
    </div>
  </q-page>
</template>
<script setup lang="ts">
import {useTitleHelper} from '@njt/foundation/hooks/titleHelper'
import {reactive} from 'vue'

const pageTitle = '库存在贴标区超过10天数'
useTitleHelper(pageTitle)

let $d = reactive({
  searchBarVisibility: true,
})


const doSend = function () {
  void $f.ui.messageBox({
    caption: '操作确认',
    text: '确定要立即发送吗?',
    icon: 'Question',
    buttons: 'OkCancel',
    delayClose: true
  }).then((btn) => {
    if (btn === 'ok') {
      $f.axios
          .post('/project/mhlbc/rpt/get-inv-in-the-labeled-zone-for-more-than-setting-days-warning')
          .then(() => {
            $f.ui.closeMsgBox()
          })
          .catch((err) => {
            void $f.ui.messageBox({
              caption: '发送失败',
              text: $f.getAxiosErrMsg(err),
              icon: $f.getAxiosErrIcon(err),
              buttons: 'Close'
            })
          })
    }
  })
}

</script>
